<?php
$q = isset($_POST["q"])? $_POST["q"] : "";
if (is_array($q)){
    $sites = array(
        'RUNOOB' => '菜鸟教程: http://www.runoob.com',
        'GOOGLE' => 'Google 搜索: http://www.google.com',
        'TAOBAO' => '淘宝: http://www.taobao.com',
    );
    foreach ($q as $val){
            echo $sites[$val] . PHP_EOL;
        }

}else{
    ?>
<form action="" method="post">
    <select multiple="multiple" name="q[]">
        <option value="">请选择网址</option>
        <option value="RUNOOB">RUNOOB</option>
        <option value="GOOGLE">Google</option>
        <option value="TAOBAO">Taobao</option>
    </select>
    <input type="submit" value="提交">
</form>
<?php
}

?>
